package com.top75;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author: huangzhigao
 * @Date: 2023/5/14 18:57
 */
public class Code1456 {
    public static int maxVowels(String s, int k) {
        Set<Character> set = new HashSet<>();
        set.add('a');
        set.add('e');
        set.add('i');
        set.add('o');
        set.add('u');
        char[] chars = s.toCharArray();
        int res = 0;
        int left = 0;
        int right = 0;
        int count = 0;
        while (right < chars.length) {
            if (set.contains(chars[right])) {
                count++;
            }
            if (right - left + 1 >= k) {
                res = Math.max(res, count);
                if (set.contains(chars[left])) {
                    count--;
                }
                left++;
            }
            right++;
        }
        return res;
    }


    public static void main(String[] args) {
        String s = "novowels";
        maxVowels(s,1);
    }
}
